<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //私有属性，加   #   符号,只能在内部使用，不能再外部被调用m,只能在当前类中访问
        class user{
            #url="htpps://www.baidu.com";//私有属性
           
             get url(){
                return this.#url;
             }
             set url(value){
                 this.#url=value;
                 this.#check();
             }
             #check(){
                console.log( this.#check.length>5? true:false);
             }
        }
        let u = new user();
        // console.log(u.name);//undefined
        //  u.#url="https:cdtw.com"; //报错，不能访问私有属性
       u.url="https";
       console.log(u);//{#url: 'https'}
       
    </script>
</body>
</html>